#define paginate(currentPage, totalPage, link)
	#if(totalPage <= 0 || currentPage > totalPage)
	 	#return
	 #end
	 
	#setLocal(startPage = 1)
	
	#if (startPage < 1) 
		setLocal(startPage = 1) 
	#end
	
	#setLocal(endPage = startPage + 4)
	
	#if (endPage > totalPage) 
		#setLocal(endPage = totalPage) 
	#end
	<nav aria-label="Page navigation">
	  <ul class="pagination">
	  
	  		#if(currentPage <= 1)
	  			<li><a href="#(link)#(1)#(append)" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li>
	  		#else
		    	<li><a href="#(link)#(currentPage - 1)#(append)" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li>
			#end
			
			#if(currentPage > 0)
				#if(currentPage + 4 < totalPage)
					#setLocal(startPage = currentPage)
					#setLocal(endPage = currentPage+4)
				#else
					#setLocal(startPage = totalPage-4)
					#setLocal(endPage = totalPage)
				#end
			#else
				#setLocal(startPage = 1)
				#setLocal(endPage = 5)
			#end
			
			#for(i : [startPage..endPage])
				#if (currentPage == i)
					 <li><a href="#(link)#(i)#(append)">#(i)</a></li>
				#else
					 <li><a href="#(link)#(i)#(append)">#(i)</a></li>
				#end
			#end
			
			#if(currentPage == totalPage)
				<li><a href="#(link)#(totalPage)#(append)" aria-label="Next"><span aria-hidden="true">&raquo;</span></a></li>
			#else
		    	<li><a href="#(link)#(currentPage + 1)#(append)" aria-label="Next"><span aria-hidden="true">&raquo;</span></a></li>
	  		#end
	  </ul>
	</nav>
#end